package com.wangcanxuan.www.dao.mapper;

import com.wangcanxuan.www.annotation.orm.ReturnType;
import com.wangcanxuan.www.annotation.orm.Select;
import com.wangcanxuan.www.entity.po.Like;
import com.wangcanxuan.www.proxy.constants.ReturnDataType;

/**
 * 点赞类Mapper
 *
 * @author HHLJ
 * @date 2022/04/01
 */
public interface LikeMapper extends BaseMapper<Like>{

    /**
     * 为用户选择喜欢
     *
     * @param userId 用户id
     * @return {@link Long}
     */
    @Select(sql = "SELECT count(*) FROM `like` WHERE liked_user_id = ?")
    @ReturnType(returnType = ReturnDataType.FIELD)
    Long selectLikesForUser(String userId);
}
